using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Search : System.Web.UI.Page
{
    ProductBll pBll = new ProductBll();
    Product p = new Product();
    private void Load()
    {
        string id = Request["pid"];
        if (id != null)
        {            
            p = pBll.GetByID(int.Parse(id));
            lblChieuDai.Text = p.ChieuDai;
            lblChungLoaiXe1.Text = p.ChungLoaiXe;
            lblCoLopSau.Text = p.CoLopSau;
            lblCoLopTruoc.Text = p.CoLopTruoc;
            lblCongSuat.Text = p.CongSuat;
            lblDungTichNL.Text = p.DungTichNL.ToString();
            lblHangSanXuat.Text = p.HangSanXuat;
            lblHangSanXuat1.Text = p.HangSanXuat;
            lblHopSo.Text = p.HopSo;
            lblHopso1.Text = p.HopSo;
            lblKichThuoc.Text = p.KichThuoc;
            lblLoaiNL.Text = p.NhienLieu;
            lblModel.Text = p.Model;
            lblModel1.Text = p.Model;
            lblMomen.Text = p.Momen;
            lblMucTieuHaoNL.Text = p.TieuHaoNL;
            lblNam.Text = p.Nam.ToString();
            lblSoCua.Text = p.SoCua.ToString();
            lblSoGhe.Text = p.SoGhe.ToString();
            lblTinhTrang.Text = p.TinhTrang;
            lblTinhTrang1.Text = p.TinhTrang;
            lblTitleProduct.Text = p.ChungLoaiXe;
            lblTuTrong.Text = p.TuTrong;
            lblXilanh.Text = p.Xilanh;
            lblXuatXu.Text = p.XuatXu;
            lblXuatXu1.Text = p.XuatXu;
            txtXeChon.Text = p.ChungLoaiXe;
            lblTrangThietBi.Text = p.TrangThietBi;

            imgImage1.ImageUrl = p.Image1;
            if (p.Image2 != null)
                imgImage2.ImageUrl = p.Image2;
            else
                imgImage2.Visible = false;

            if (p.Image3 != null)
                imgImage3.ImageUrl = p.Image3;
            else
                imgImage3.Visible = false;

            if (p.Image4 != null)
                imgImage4.ImageUrl = p.Image4;
            else
                imgImage4.Visible = false;

            if (p.Image5 != null)
                imgImage5.ImageUrl = p.Image5;
            else
                imgImage5.Visible = false;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Load();
            pnlThongSoKyThuat.Visible = true;
            pnlTrangThietBi.Visible = false;
            pnlLienHeMuaXe.Visible = false;
            pnlLienHeThanhCong.Visible = false;
        }
    }
    protected void btnThongSoKyThuat_Click(object sender, EventArgs e)
    {

        pnlThongSoKyThuat.Visible = true;
        pnlTrangThietBi.Visible = false;
        pnlLienHeMuaXe.Visible = false;
        pnlLienHeThanhCong.Visible = false;

    }
    protected void btnTrangThietBi_Click(object sender, EventArgs e)
    {

        pnlThongSoKyThuat.Visible = false;
        pnlTrangThietBi.Visible = true;
        pnlLienHeMuaXe.Visible = false;
        pnlLienHeThanhCong.Visible = false;

    }
    protected void btnLienHeMuaXe_Click(object sender, EventArgs e)
    {
        pnlThongSoKyThuat.Visible = false;
        pnlTrangThietBi.Visible = false;
        pnlLienHeMuaXe.Visible = true;
        pnlLienHeThanhCong.Visible = false;
    }
    protected void lbtnLienhe_Click(object sender, EventArgs e)
    {
        pnlThongSoKyThuat.Visible = false;
        pnlTrangThietBi.Visible = false;
        pnlLienHeMuaXe.Visible = true;
    }
    protected void btnReset_Click(object sender, EventArgs e)
    {
        txtDiaChiLienHe.Text = "";
        txtEmailLienHe.Text = "";
        txtXeChon.Text = p.ChungLoaiXe;
        txtTenLienHe.Text = "";
    }
    protected void btnGuiLienHe_Click(object sender, EventArgs e)
    {
        pnlThongSoKyThuat.Visible = false;
        pnlTrangThietBi.Visible = false;
        pnlLienHeMuaXe.Visible = false;
        pnlLienHeThanhCong.Visible = true;
    }
}
